//
//  UIView+BBKit.h
//  goodsOwner
//
//  Created by apple on 2019/6/28.
//  Copyright © 2019年 fandecai. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "BBBaseViewModel.h"
#import "BBLabelViewModel.h"
#import "BBViewModel.h"
#import "BBImageViewModel.h"
#import "BBControllerViewModel.h"
#import "BBTextFieldViewModel.h"
#import "BBUIButtonViewModel.h"
#import "BBSwichViewModel.h"
#import "BBScrollViewModel.h"
#import "BBTextViewModel.h"
#import "BBTableViewModel.h"
#import "BBCollectionViewModel.h"

#define BBKIT_REGIST_VIEW_API(methodName,UIViewClass,ViewModel) \
- (ViewModel * (^)(NSInteger tag))methodName{\
    return ^(NSInteger tag){\
        UIViewClass * view = [[UIViewClass alloc] init];\
        [self addSubview:view];\
        ViewModel * model = [[ViewModel alloc] initWithTag:tag andView:view];\
        return model;\
    };\
}


NS_ASSUME_NONNULL_BEGIN

@interface UIView (BBKit)

/**UIView*/
@property (nonatomic, copy, readonly) BBViewModel *(^ addView)(NSInteger tag);

/**UILabel*/
@property (nonatomic, copy, readonly) BBLabelViewModel *(^ addLabel)(NSInteger tag);
/// 添加ImageView
@property (nonatomic, copy, readonly) BBImageViewModel *(^ addImageView)(NSInteger tag);

#pragma mark - # 按钮类
/**Control*/
@property (nonatomic, copy, readonly) BBControllerViewModel *(^ addControl)(NSInteger tag);

/**添加TextField*/
@property (nonatomic, copy, readonly) BBTextFieldViewModel *(^ addTextField)(NSInteger tag);

/**添加Button*/
@property (nonatomic, copy, readonly) BBUIButtonViewModel *(^ addButton)(NSInteger tag);

/**添加Switch*/
@property (nonatomic, copy, readonly) BBSwichViewModel *(^ addSwitch)(NSInteger tag);

#pragma mark - # 滚动视图类
/**添加ScrollView*/
@property (nonatomic, copy, readonly) BBScrollViewModel *(^ addScrollView)(NSInteger tag);

/**添加TextView*/
@property (nonatomic, copy, readonly) BBTextViewModel *(^ addTextView)(NSInteger tag);

/**添加TableView*/
@property (nonatomic, copy, readonly) BBTableViewModel *(^ addTableView)(NSInteger tag);

/**添加CollectionView*/
@property (nonatomic, copy, readonly) BBCollectionViewModel *(^ addCollectionView)(NSInteger tag);

@end

NS_ASSUME_NONNULL_END
